package com.band.controller;

import com.band.entity.ClazzCountOption;
import com.band.entity.JobOption;
import com.band.entity.Result;
import com.band.service.ClazzService;
import com.band.service.EmpService;
import com.band.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
public class ReportController {
    @Autowired
    private EmpService empService;

    @Autowired
    private StudentService studentService;

    @Autowired
    private ClazzService clazzService;

    /**
     * 员工性别数据统计
     * @return
     */
    @GetMapping("/report/empGenderData")
    public Result empGenderData(){
        List<Map> list = empService.empGenderData();
        return Result.success(list);
    }
    /**
     * 员工职位数据统计
     * @return
     */
    @GetMapping("/report/empJobData")
    public Result empJobData(){
        JobOption jobOption = empService.empJobData();
        log.info("jobOption{}",jobOption);
        return Result.success(jobOption);
    }

    /**
     * 学生学历数据统计
     * @return
     */
    @GetMapping("/report/studentDegreeData")
    public Result studentDegreeData(){
       List<Map> list =  studentService.studentDegreeData();
       return Result.success(list);
    }


    /**
     * 班级学生数量统计
     * @return
     */
    @GetMapping("/report/studentCountData")
    public Result studentCountData(){
        ClazzCountOption countOption = clazzService.studentCountData();
        return Result.success(countOption);
    }
}
